<!--
 * @Description  : docx预览
 * @Author       : zhao
 * @Date         : 2022-07-21 14:52:05
 * @LastEditors  : zhao
 * @LastEditTime : 2023-01-13 09:52:40
-->

<template>
    <div class='' ref="files" id="files">

    </div>

</template>

<script >
import { ref, watch, nextTick, } from 'vue';
import { usePreview } from '/@/stores/preview'
// let docx = require("docx-preview");

import * as docx from 'docx-preview'
// import docx from 'docx-preview';
const files = ref()
const usepreviews = usePreview()
const goPreview = (data) => {
    nextTick(() => {


        docx.renderAsync(data, document.getElementById("files")); // 渲染到页面

    })
}
usepreviews.$subscribe((mutation, state) => {

    goPreview(state.previewType.data)
})



</script>
<style lang='scss' scoped>
</style>